闘本 1.8 ゼロの行列
提出
code: txt
# m = 3, n = 4
# [
#
1, 0, 3, 4
,
#
1, 2, 3, 4
,
#
1, 2, 0, 4
,
# ]
def to_zero(m, n, matrix):
x = set()
y = set()
for i in range(m):
for j in range(n):
if matrix
i
j
== 0:
x.add(i)
y.add(j)
for i in range(m):
for j in range(n):
if i in x or j in y:
matrix
i
j
= 0
return matrix